<?php
require('../includes/init.php');
$domain = "https://www.pentalink.com";
?>
<?php
require(ROOT_PATH . '/includes/lib_array.php');
require(ROOT_PATH . '/includes/lib_attribute.php');
require(TMP_PATH . '/config/cfg_product_cate_new.php');
require(TMP_PATH . '/config/cfg_standard_cate.php');
require(TMP_PATH . '/config/cfg_brand.php');
require(TMP_PATH . '/config/cfg_txt_cate.php');
require(TMP_PATH . '/config/cfg_rel_cate.php');

$sql = "SELECT count(*) FROM `cart` WHERE `session_id`='".$_SESSION[SESSION_PREFIX]['session_id']."';";
$cart_sum = $db->getOne($sql);

$product_id = (isset($_GET['id'])&&$_GET['id']<>'')?$_GET['id']:'1';


$sql = "SELECT * FROM `product_detail` WHERE `product_id`='".$product_id."' AND `is_show`='1' AND `is_del`='0'";
$skuItem = $db->getRow($sql);
$has3D = false;
if($skuItem){
  $url = "https://evan-embedded.partcommunity.com/3d-cad-models/sso/?showportlets=preview&catalog=evan&hideportlets=generation&part=" . $skuItem["sku"];
  $data = file_get_contents($url);
  
  if(strpos($data, "抱歉，该型号暂无3D模型") || strpos($data, "The requested part could not be found")){
    $_SESSION['$leos']='201';
    $has3D = false;
  }else{
    $has3D = true;
  }
}

function get_str($str)
{
    if(strstr($str, '(')){
        $arr = explode('(',$str);
        $str = rtrim($arr[1],')');
    }
    return $str;
}

//dump($_GET);
//dump($product_id);

//读取产品信息
$leo=0;

$sql = "SELECT * FROM `product` WHERE `product_id`='".$product_id."';";
$product = $db->getRow($sql);

// print_r($product);
// exit;
$bigcate = $product['bigcate_id'];

//读取模型信息
$sql = "SELECT * FROM `product_model` WHERE `product_id`='".$product['model_id']."'";
$model=$db->getRow($sql);
$x_name = $model['x_name']==''?'公称直径d':$model['x_name'];
$y_name = $model['y_name']==''?'公称长度L':$model['y_name'];

/**
 * 规格筛选，地址处理
 */
 
function pd_url($params)
{
  return 0;
	$url = "./proDetail.php?id=". $params['id'] . "&cate_id=" . $params['cate_id'];
	$params = array_filter($params, 'strlen');
	unset($params['id']);
	if (!empty($params))
	{
		$url .= '&' . http_build_query($params, '', '&');
	}
	return $url;
}


$sql = "SELECT * FROM `product_txt` WHERE `product_id`='".$product_id."' AND `detail`<>''";
$txt_list = $db->getAll($sql);

//seo处理
$attr_str = $_GET['d']?$x_name.':'.$_GET['d'].' ' : '';
$attr_str .= $_GET['l']?$y_name.':'.$_GET['l'].' ' : ' ';
$attr_str .= $_GET['b']?'品牌:'.$cfg_brand[$_GET['b']].' ' : ' ';
$title = $product['title'].' '.$attr_str;
$keyword = $product['keyword']<>''?$product['keyword']:$product['title'].' '.$attr_str;
$description = $product['description']<>''?$product['description']:$product['title'].' '.$attr_str;

$cateId = $_GET["cate_id"];
$cate_id = $cateId;
if(empty($cateId)){
    $cateId = 0;
}
$cateInfo = $db->getRow("select * from `product_cate` where `cate_id` = $cateId");
if(empty($cateInfo)){
    $cateInfo["cate_name"] = "";
}else{
    if($cateInfo["parent_id"] > 0){
        $parentCate = $db->getRow("select * from `product_cate` where `cate_id` = " . $cateInfo["parent_id"]);
    }
}

?>
<link href="/css/v1/page.css" rel="stylesheet" type="text/css" />
<link href="/static/layui/css/layui.css" rel="stylesheet" type="text/css" />
    <link href="/css/yjtview.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link href="/css/v1/product.detail.css?v=2.03" rel="stylesheet" type="text/css">

<style>
    .zoomdiv{
      top: 0!important;
      left: 305px!important;
    }
    .layui-layer.layui-layer-iframe{
        top: 100px!important;
    }
    .gg_table .t1 td{
        top: 0px;
        background-color: #7A91A6;
        color: #FFFFFF;
    }
    .mod_search_guide .selected_title{
        width: 100px;
        font-size: 14px;
    }
    .mod_search_guide .selected_box {
        width: 930px;
    }
    .mod_search_guide .guide_main{
        width: 0px;
    }
    .ksbj_a_cut.ksbj_cont.box a{
        color: white;
    }
</style>
<style>
      .wj_sitenav{
        z-index: 1001!important;
      }
      .header_div{
        z-index: 1000!important;
      }
      .nav_fixed{
        z-index: 100;
      }
        .line{
            content: "";
            position: absolute;
            top: 44px;
            left: 0;
            right: 0;
            height: 1px;
            background-color: #e7e7e7;
        }
        .dialog-title{
            line-height: 40px;
            font-size: 18px;
        }
        .step-back{
            position: absolute;
            top: 20px;
            left: 20px;
            cursor: pointer;
        }
        .step-back:hover{
            color:52b0c6;
        }
        .iframeClass{
            /* height: 450px; */
            /* overflow: hidden; */
        }
        .dialog-model{
            margin-top: 10vh!important;
        }
        .from-dialog-model{
          margin-top: 18vh!important;
        }
        .from-dialog-body{
          border: 1px solid #409EFF;
          margin-top: 25px;
        }
        .from-dialog-body-title{
          width: 100%;
          background-color: #409EFF;
          text-align: center;
          color: white;
          height: 40px;
          font-size: 14px;
          font-weight: bold;
          line-height: 40px;
        }
        .img1{
          display: inline-block;
          width: 30px;
          height: 30px;
          background-image: url(/img/view.png);
          background-size: 100% 100%;
          background-repeat: no-repeat;
          background-position: 0;
        }
        .img1:hover{
          background-image: url(/img/view.png);
          cursor:pointer;
        }
        .img2{
          padding-left: 25px;
          background-image: url(/img/down.png);
          background-size: 20px 20px;
          background-position: 0;
          background-repeat: no-repeat;
          display: inline-block;
          color: #E90211;
          font-size: 14px;
          font-weight: 600;
        }
        .img2:hover{
          cursor:pointer;
          background-image: url(/img/down.png);
        }
    </style>
<?php include('./header.php');?>
<el-dialog
        :visible.sync="centerDialogVisible"
        width="1350px"
        center
        custom-class="dialog-model"
        style="background-color: rgba(0,0,0,.6);display: none;"
        >
        <div class="line"></div>
        <div class="dialog-title">
            3D模型
            <el-button  v-show="!downPage"  @click="downLoadNow" type="primary" size="small" style="position: absolute;left: 280px;top: 108px;">立即下载</el-button>
        </div>
        <div style="width: 1290px;height: 50px;position: absolute;bottom: 20px;background: white;"></div>
        <div class="iframeClass">
                <iframe style="overflow: hidden;" width="1290px" height="710px" :src="url1" frameborder="0"></iframe>
          
                <!-- <iframe style="overflow: hidden;" width="500px" height="710px" :src="url1" frameborder="0"></iframe>
                <iframe v-show="!downPage" style="overflow: hidden;position: relative;top: -20px;" width="500px" height="710px" :src="url2" frameborder="0"></iframe>
             -->
             
                <div v-show="downPage" style="width: 522px;height: 660px;text-align: center;position: absolute;top: 100px;right: 47px;z-index: 999;background: white;">
                    <div class="content" style="display:inline-block;width:300px ;height: 500px;margin-top: 50px;text-align: left;">
                        <el-select  @change="changeSelect1" v-model="value" placeholder="请选择" style="display:inline-block;width:150px ;">
                            <el-option
                              v-for="item in options"
                              :key="item.value"
                              :label="item.label"
                              :value="item.value">
                            </el-option>
                          </el-select>
                          <el-select filterable v-model="plant" placeholder="请输入下载文件格式" style="display:inline-block;width:300px;margin-top: 10px;">
                            <el-option
                              v-for="item in options2"
                              :key="item.value"
                              :label="item.label"
                              :value="item.value"
                              >
                            </el-option>
                          </el-select>
                          <el-select  @change="changeSelect" v-model="sku" placeholder="请选择" style="display:inline-block;width:300px;margin-top: 10px;">
                            <el-option
                              v-for="item in options1"
                              :key="item.value"
                              :label="item.label"
                              :value="item.value"
                              >
                            </el-option>
                          </el-select>
                          <div style="font-size: 13px;margin-top: 20px;">
                            <el-checkbox v-model="check1" style="color:#525252!important;"><span style="color:#525252!important;">我同意</span><a style="color:#409EFF" target="_blank" href="./newsdetail.php?id=17">五联五金网隐私政策</a></el-checkbox>
                            <el-checkbox v-model="check2" style="color:#525252!important;"><span style="color:#525252!important;">我同意将我的个人信息共享给五联五金网的关联公司</span></el-checkbox>
                          </div>
                          <el-button style="width: 100%;margin-top:100px;" @click="downLoadImage" type="primary">立即下载</el-button>
                    </div>
                </div>
            </div>
        <div class="step-back"  @click="downPage = !downPage"  v-show="downPage">
            <i class="el-icon-arrow-left" style="font-size: 16px;"></i>
        </div>
        </el-dialog>
        <el-dialog
      :visible.sync="fromDialog"
      width="630px"
      center
      custom-class="from-dialog-model"
      style="background-color: rgba(0,0,0,.6);display: none;"
      >
      <div class="from-dialog-title">
        当前商品：“{{sku}}”</span>暂未有3D图纸，请您填写表格，我们会尽快完成创建，并及时与您联系。
      </div>
      <div class="from-dialog-body">
        <div class="from-dialog-body-title">3D建模申请表</div>
        <div style="margin-left: 50px;margin-top: 30px;">
          零件号：&nbsp;&nbsp;<el-input  style="width: 280px;" v-model="skuText" placeholder="请输入零件号"></el-input>
        </div>
        <div style="margin-left: 50px;margin-top: 20px;">
          备&nbsp;&nbsp;&nbsp;注：&nbsp;&nbsp;<el-input style="width: 400px;" v-model="note" placeholder="图纸格式/及特殊要求"></el-input>
        </div>
        <div style="margin-left: 50px;margin-top: 30px;margin-bottom: 30px;">
          <el-button style="width: 160px;" @click="saveSeek" type="primary">发送请求</el-button>
        </div>
      </div>
    </el-dialog>
            <!-- 头部搜索框以及导航栏 -->
            <div class="header_div">
                <?php include('./common/search.php');?>
                <?php include('./common/nav.php');?>
            </div>
            <!-- 标签 -->
            <div class="post_position">
                <?php
                //处理分类
                $cate_arr = explode(',', $product['cate_ids']);
                ?>
                <span class="home_span"><a href="./index.php">首页 > </a></span>

                <?php if($parentCate): ?>
                  <span><a href="./product.php?cate_id=<?php echo $parentCate["cate_id"]; ?>"> 
                    <?php echo $parentCate["cate_name"]; ?> > 
                  </a></span>
                <?php endif; ?>

                <?php if($cateInfo["cate_name"] != ""): ?>
                  <span><a href="./product.php?cate_id=<?php echo $cateInfo["cate_id"]; ?>"> 
                    <?php echo $cateInfo["cate_name"]; ?> > 
                  </a></span>
                <?php endif; ?>

                <span><?php echo $product['title'];?></span>
            </div>

           
            <div class="proDetail">
                <div class="top_proDetail_content box">
                    <div class="top_proDetail_imgs fl">
                        <div class="top_pro_big_img box jqzoom">
                            <!-- <div class="swiper-container gallery-top"> -->
                                <!-- <div class="swiper-wrapper"> -->
                                <?php
                                $sql = "SELECT *,if(`sort_order` > '0',1,0) AS `is_order` FROM `product_pic` WHERE `product_id`='".$product_id."' AND `ftype` IN (1,10) ORDER BY `is_order` DESC, `sort_order`;";
                                $pic_list = $db->getAll($sql);
                                $ii=1;
                                if(!empty($pic_list)):
                                // foreach($pic_list as $key => $pic):
                                ?>
                                <img class="pro_top_img" src="<?php echo $domain; ?>/upload<?php echo $pic_list[0]['pic100']<>''?$pic_list[0]['pic100']:'/none.jpg';?>" alt="<?php echo $pic_list[0]['title']==''?$product['title']:$pic_list[0]['title'];?>" jqimg="<?php echo $domain; ?>/upload<?php echo $pic_list[0]['pic100']<>''?$pic_list[0]['pic100']:'/none.jpg';?>" />
                                <?php
                                // $ii++;
                                // endforeach;
                                else:
                                ?>
                                <div class="swiper-slide"><img src="<?php echo $domain; ?>/upload/none.jpg" alt="<?php echo $product['title'];?>" /></div>
                                <?php endif;?>
                                <!-- </div> -->
                                <!-- Add Arrows -->
                                <!-- <div class="swiper-button-next swiper-button-white"></div>
                                <div class="swiper-button-prev swiper-button-white"></div> -->
                            <!-- </div> -->
                        </div>
                        <div class="top_pro_small_imgs box">
                            <div class="top_pro_small_cont box">
                                <div class="swiper-container" id="top_pro_small_cont_swiper">
                                    <div class="swiper-wrapper">
                                        <?php
                                        $sql = "SELECT *,if(`sort_order` > '0',1,0) AS `is_order` FROM `product_pic` WHERE `product_id`='".$product_id."' AND `ftype` IN (1,10) ORDER BY `is_order` DESC, `sort_order`;";
                                        $pic_list = $db->getAll($sql);
                                        $ii=1;
                                        if(!empty($pic_list)):
                                        foreach($pic_list as $key => $pic):
                                        ?>
                                        <div class="swiper-slide box"><img class="pro_bottom_img" src="<?php echo $domain; ?>/upload<?php echo $pic['pic100']<>''?$pic['pic100']:'/none.jpg';?>" alt="<?php echo $pic['title']==''?$product['title']:$pic['title'];?>" /></div>
                                        <?php
                                        $ii++;
                                        endforeach;
                                        else:
                                        ?>
                                        <div class="swiper-slide"><img src="<?php echo $domain; ?>/upload/none.jpg" alt="<?php echo $product['title'];?>" /></div>
                                        <?php endif;?>
                                       
                                        
                                    </div>
                                    <!-- Add Arrows -->
                                    <div class="pick_btn_flr pick_btn_prev"><img src="../img/ico_pro_left.png" alt="翻页左"></div>
                                    <div class="pick_btn_flr pick_btn_next"><img src="../img/ico_pro_right.png" alt="翻页右"></div>

                                </div>
                           
                            </div>
                        </div>
                    </div>
                    <div class="top_proDetail_menu fl">
                        <h1>
                          <?php echo $product['title'];?>
                            <div style="display: inline-block;float: right;">
                              <ul class="top_proDetail_h1_ul">
                              <?php
                              //读取用户收藏的产品id，用于下面判断是否在收藏夹
                              $sql = "SELECT count(*) FROM `user_favorites` WHERE `user_id`='".$_SESSION[SESSION_PREFIX]['user_id']."' AND `product_id`='".$product['product_id']."';";
                              $is_fav = $db->getOne($sql);
                              ?>
                                <li onClick="addToFav('<?php echo $product['product_id'];?>');" id="collect_product" class="box <?php if($is_fav>0) echo 'act_li';else echo '';?>">
                                  <a class="shoucangBtn"><?php if($is_fav>0):?>取消收藏<?php else: ?>加入收藏 <?php endif; ?>：</a>
                                </li>
                                <li class="box phone_scan"  style="background-position: 76px 3px">
                                  <a>分享到微信：</a>
                                  <div class="shibie_block box">
                                    <img src="<?php echo $domain; ?>/upload/product_qr/<?php echo $product_id; ?>.png" alt="二维码">
                                    <p>手机扫一扫</p>
                                  </div>
                                </li>
                              </ul>
                            </div>
                        </h1>
                      
                        <div class="proDetail_bottom_menu box">
                            <div class="proDetail_menu_info fl">
                              <div style="font-size: 14px;">
                              <?php 
                              	//读取产品的具体规格
                                $sql = "SELECT * FROM `product_detail` WHERE `product_id`='".$product_id."' AND `is_show`='1' AND `is_del`='0'{$sqlSS}";
                                // AND `price`>0
                                if($_GET['d']<>'')
                                {
                                  $sql .= " AND `x_value`='".$_GET['d']."'";
                                }
                                if($_GET['l']<>'')
                                {
                                  $sql .= " AND `y_value`='".$_GET['l']."'";
                                }
                                if($_GET['b']<>'')
                                {
                                  $sql .= " AND `brand_id`='".$_GET['b']."'";
                                }
                                $sql .= " ORDER BY `pd_id`;";
                                $gg_list = $db->getAll($sql);
                                ?>
                                规格款式：&nbsp;&nbsp;<?php echo count($gg_list); ?>款
                                <br />
                                所属类型：&nbsp;&nbsp;<?php echo $cfg_product_cate['b'.$bigcate]['0'][$cate_arr[0]];?>
                                <br />
                                计量单位：&nbsp;&nbsp;<?php echo $product["unit"]; ?>
                                <br />
                                <!-- 起售价格：&nbsp;&nbsp;120元/千个 -->
                                <br />
                              </div>
                                <!-- <div class="pick_downlond box"><a href="#here">3D渲染及图纸下载</a></div> -->
                                <ul>
                                    <?php
                                    if(!empty($model) && $model['standard_code']<>""):
                                    ?>
                                    <li >
                                        <div class="fl box">标准</div>
                                        <div class="fr box"><?php echo $model['standard_code'];?></div>
                                    </li>
                                    <?php endif;?>
                                    <li >
                                        <div class="fl box">制式</div>
                                        <div class="fr box"><?php if($model['gyz']=='1') echo '公制'; else echo '寸制（英制/美制）';?></div>
                                    </li>

                                    <?php
                                    //读取产品属性的名值对
                                    $sql = "SELECT `attr_id`,`attr_value` FROM `product_attr` WHERE `product_id`='".$product['product_id']."';";
                                    $product_attr = $db->getAll($sql);
                                    $product_attr_ids = $db->getCol($sql);
                                    $product_attr = array_to_hashmap_arr($product_attr, 'attr_id', 'attr_value');
                                    //一级属性
                                    $attr_list = attribute_list(0, '', true, 'all');
                                    if(!empty($attr_list)):
			                        foreach($attr_list as $attr):
                                    if(in_array($attr['attr_id'], $product_attr_ids) && count($product_attr[$attr['attr_id']])):
                                    ?>
                                        <li >
                                            <div class="fl box"><?php echo $attr['attr_name']?></div>
                                            <div class="fr box"><?php
                                            $attr2_list = attribute_list($attr['attr_id']);
                                            $attr2_list = array_to_hashmap($attr2_list, 'attr_id', 'attr_name');
                                            foreach($product_attr[$attr['attr_id']] AS $kk=>$vv) {
                                                echo $attr2_list[$vv]." ";
                                            }
                                            ?></div>
                                        </li>

                                            <?php
                                            //牌号,上面循环了一级属性，所以没有牌号
                                            if($attr['attr_id']=='50' && $product['paihao']<>'0'):
                                            ?>
                                                <li >
                                                    <div class="fl box">牌号</div>
                                                    <div class="fr box"><?php
                                                    $attr2_list = attribute_list($product['cailiao']);
                                                    $attr2_list = array_to_hashmap($attr2_list, 'attr_id', 'attr_name');
                                                    echo $attr2_list[$product['paihao']];
                                                    ?></div>
                                                </li>

                                            <?php
                                            //牌号
                                            endif;
                                            ?>
                                    <?php
                                    endif;
                                    endforeach;
                                    endif;
                                    ?>
                                    
                                </ul>
                                
                            </div>
                            <div class="proDetail_menu_phoneto fl">
                                <img src="<?php echo $domain; ?>/upload<?php echo $model['pic']<>''?$model['pic']:'/none.jpg';?>" alt="<?php echo $model['title'];?>" style="border:#CCC 1px dotted" id="model_pic"> 
                            </div>
                        </div>
                    </div>
                </div>

                <div class="proDetail_content">
                    <ul class="proDetail_content_nav">
                        <li class="act">规格型号表</li>
                        <?php 
                        //列表
                        if(count($txt_list)){
                        ?>
                            <?php $ipt=0;foreach($txt_list as $key => $list): $ipt++;?>
                            <li class="proDetail_content_block_<?php echo $key; ?>"><?php echo $cfg_txt_cate[$list['ttype']]; ?></li>
                            <?php endforeach; ?>
                        <?php }?>
                    </ul>

                    <div class="proDetail_content_block box xinghao">
                        <div class="basic_infor">

                            <!--s 规格列表-->

    <div style="width:100%; max-height:500px;overflow:auto;">
      <?php 
  $cpcs_arr = explode(',', $product['cpcs']);
  $column_num = count($cpcs_arr);
  $lotflag=$column_num>=8?1:0;
  ?>
      <a name="here2"></a>
      <form action='<?php echo $_SERVER['REQUEST_URI'];?>#here2' method="get"  id="myform">
        <input type="hidden" value="<?php echo $product_id;?>"  name="id">
        <input type="hidden" value="<?php echo $cateId;?>"  name="cate_id">
        <table width="100%" style="min-width:<?php echo $column_num*100+355; ?>px;" border="0" cellspacing="1" cellpadding="0" bgcolor="#CCCCCC" class="gg_table">
          <tr class="t1" style="font-size:12px; line-height:1.5pc;text-align:center;" >
            <td style="left:1px;z-index:999;outline-color: #b6b6b6;outline-width: 1px;outline-style: dotted;" width="120" align="center" valign="top"><div style="float:left; width:100%; padding-top:5px; height:78px; line-height:74px; padding-left:8px; padding-right:8px;">SKU</div></td>
            <?php
				if($product['cpcs']<>''):

				$i=1;$sqlSS="";
				foreach($cpcs_arr as $ck => $ct){
                    $new_cts = get_str($ct);
					$c="v".$i;
						if($_GET[$new_cts]<>'')
						{
							$sqlSS .= " AND `{$c}`='".urldecode($_GET[$new_cts])."'";
						}	
						$i++;
					}
				$i=1;reset($cpcs_arr);
				foreach($cpcs_arr as $ck => $ct):
//                    $new_ct = $ct;
                    $new_cts = get_str($ct);
				?>
            <td width="80" align="center" valign="top" style="font-size:12px;"><div style="white-space: nowrap;float:left; width:100%; padding-top:5px; height:45px; line-height:1.5pc; padding-left:8px; padding-right:8px;"><?php echo str_replace("(","<br>(",$ct);?> <?php echo strstr($ct, '(')==""?"":"";?> <br>
              <?php
				$order_field = ",REVERSE(SUBSTRING(REVERSE(`v".$i."`), LOCATE(CHAR(9), REVERSE(`v".$i."`))+1)) +1 AS od_v";
				$sql = "SELECT DISTINCT `v".$i."`".$order_field." FROM `product_detail` WHERE `product_id`='".$product_id."' AND `is_show`='1' AND `is_del`='0'{$sqlSS} ";
				//AND `price`>0
				if($_GET['d']<>'')
				{
					$sql .= " AND `x_value`='".$_GET['d']."'";
				}
				if($_GET['l']<>'')
				{
					$sql .= " AND `y_value`='".$_GET['l']."'";
				}
				$sql .= " ORDER BY `od_v`,`v".$i."`";
				$v_list[$i] = $db->getCol($sql);
				$cc="v".$i;
				?>
                </div>
                <div style="float:left; text-align:center; width:100%; margin-top:5px; padding-bottom:5px;">
              <select name="<?php echo $new_cts;?>" id="v<?php echo $i;?>" onchange="submitForm();" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width:60px;font-size: 12px;">
                <option value="" <?php if ($vv=="" ){ ?> selected<?php }?>>全部</option>
                <?php
                foreach($v_list[$i] as $vk => $vv):
                  if ($vv != ""):
                ?>
                <option value="<?php echo urlencode($vv);?>"<?php if(urldecode($_GET[$new_cts])==$vv){?> selected<?php }?>><?php echo $vv;//echo round($vv,4);?></option>
                <?php
                  endif;
                endforeach;
                ?>
              </select>
              </div>
              <?php /*?>
			  
                <select name="a<?php echo $i;?>" id="a<?php echo $i;?>" onChange="selAttr('a_<?php echo $i;?>', this.value)" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width:80px;">
                  <option value="">全部</option>
                  <?php
				if(!empty($v_list[$i])):
				//asort($v_list[$i]);
				foreach($v_list[$i] as $vk => $vv):
				?>
                  <option value="<?php echo $vk;?>"><?php echo $vv;//echo round($vv,4);?></option>
                  <?php
				endforeach;
				endif;
				?>
                </select>
				<?php */?></td>
            <?php
			    $i++;
			    endforeach;
			    endif;
			    ?>
            <td width="100" align="center" valign="top"  style="font-size: 12px;" nowrap="nowrap"><div style="white-space: nowrap;float:left; width:100%; padding-top:5px; height:45px; line-height:1.5pc; padding-left:8px; padding-right:8px;">价格<br>
              <font style="font-size:12px;color:#eeeeee;">(未税)</font></div></td>
            <td width="50" align="center" valign="top" style="font-size: 12px;"><div style="white-space: nowrap;float:left; width:100%; padding-top:5px; height:45px; line-height:1.5pc; padding-left:8px; padding-right:8px;">包装<br>
              <font style="font-size:12px;color:#eeeeee;">(<?php echo $product['unit']?$product['unit']:"个";?>/包)</font></div></td>
            <!--<td width="50" align="center" style="font-size:10px">库存/交期</td>-->
            <td width="80" align="center" valign="top" style="font-size: 12px;right: 108px;z-index: 999;outline-color: #b6b6b6;outline-width: 1px;outline-style: solid;"><div style="white-space: nowrap;float:left; width:100%; padding-top:5px; height:45px; line-height:1.5pc; padding-left:8px; padding-right:8px;">购买</div></td>
            <?php if($has3D == true): ?>
            <td width="55" align="center" valign="top" style="font-size: 12px;right: 55px;z-index: 999;outline-color: #b6b6b6;outline-width: 1px;outline-style: solid;"><div style="white-space: nowrap;float:left; width:100%; padding-top:5px; height:45px; line-height:1.5pc; padding-left:8px; padding-right:8px;">3D<br>图纸</div></td>
            <td width="55" align="center" valign="top" style="font-size: 12px;right: 1px;z-index: 999;outline-color: #b6b6b6;outline-width: 1px;outline-style: solid;"><div style="white-space: nowrap;float:left; width:100%; padding-top:5px; height:45px; line-height:1.5pc; padding-left:8px; padding-right:8px;">图纸<br>下载</div></td>
            <?php endif; ?>
            <?php if($has3D == false): ?>
            <td width="110" align="center" valign="top" style="font-size: 12px;right: 1px;z-index: 999;outline-color: #b6b6b6;outline-width: 1px;outline-style: solid;"><div style="white-space: nowrap;float:left; width:100%; padding-top:5px; height:45px; line-height:1.5pc; padding-left:8px; padding-right:8px;">图纸申请</div></td>
            <?php endif; ?>
          </tr>
          <?php
		  
	//读取产品的具体规格
	$sql = "SELECT * FROM `product_detail` WHERE `product_id`='".$product_id."' AND `is_show`='1' AND `is_del`='0'{$sqlSS}";
	// AND `price`>0
	if($_GET['d']<>'')
	{
		$sql .= " AND `x_value`='".$_GET['d']."'";
	}
	if($_GET['l']<>'')
	{
		$sql .= " AND `y_value`='".$_GET['l']."'";
	}
	if($_GET['b']<>'')
	{
		$sql .= " AND `brand_id`='".$_GET['b']."'";
	}
	$sql .= " ORDER BY `pd_id`;";
	$gg_list = $db->getAll($sql);

	$gg_list = array_sort_prepare($gg_list, 'x_value');
	$gg_list = array_sortby_multifields($gg_list, array('x_value_fc'=>SORT_DESC, 'x_value_fv'=>SORT_ASC, 'y_value'=>SORT_ASC));
	if(!empty($gg_list)):
	foreach($gg_list as $gk => $gg):
		//设置每行的class，可以根据class，用js来控制显示
		if($product['cpcs']<>''){
			$cpcs_arr = explode(',', $product['cpcs']);
			$i=1;
			$t_class = "";
			$data_str = "";
			foreach($cpcs_arr as $ck => $ct)
			{
				$att_v_k = array_flip($v_list[$i]);
				$t_class .= " a_".$i."_".$att_v_k[$gg['v'.$i]];
				$data_str .= ' data-a'.$i.'="'.$gg['v'.$i].'"';
				$i++;
			}
		}
	?>
          <tr class="t2<?php echo $t_class;?>"<?php //echo $data_str;?> style="display:; line-height:1.5pc; <?php if ($leo%2==0 ){ ?>background-color:#f6f6f6;<?php } else { ?>background-color:#eeeeee;<?php }?>">
          <?php 
          //列表
          if($gk%2 == 0):
          ?>
            <td height="45" align="center" nowrap class="gga" style="white-space: nowrap;font-size: 12px;border: none;outline-color: #b6b6b6;outline-width: 1px;outline-style: dotted;font-size:12px;position: sticky;left: 1px;background: rgb(246, 246, 246);"><a href="/new/skuDetail.php?id=<?php echo $product_id; ?>&cate_id=<?php echo $cateId; ?>&gid=<?php echo $gg['pd_id'];?>" target="_blank">
          <?php 
          endif;
          ?>
           <?php 
          //列表
          if($gk%2 != 0):
          ?>
            <td height="45" align="center" nowrap class="gga" style="white-space: nowrap;font-size: 12px;border: none;outline-color: #b6b6b6;outline-width: 1px;outline-style: dotted;font-size:12px;position: sticky;left: 1px;background: rgb(238, 238, 238);"><a href="/new/skuDetail.php?id=<?php echo $product_id; ?>&cate_id=<?php echo $cateId; ?>&gid=<?php echo $gg['pd_id'];?>" target="_blank">
          <?php 
          endif;
          ?>
          
              <?php 
		echo $gg['sku'];
		//echo str_replace("-","<br>",$gg['sku']); //yjt_sku($gg['pd_id']);//yjt_id($gg['yjt_id']);?>
              </a></td>
            <?php
			    if($product['cpcs']<>''):
			    $cpcs_arr = explode(',', $product['cpcs']);
			    $i=1;
			    foreach($cpcs_arr as $ck => $ct):
			    ?>
            <td align="center" style="white-space: nowrap;font-size: 12px;"><?php echo $gg['v'.$i]?$gg['v'.$i]:"-";?></td>
            <?php
			    $i++;
			    endforeach;
			    endif;
			    ?>
				    <td align="center" nowrap="nowrap" style="white-space: nowrap;font-size: 12px;font-size:10px;color:#999999;">
            <?php if($gg['price'] <= 0): ?>
                <a target="_blank" href="https://p.qiao.baidu.com/cps4/chatIndex?siteToken=fa9edd6c146a2526c2a20e5302b32e57&speedLogId=160263314181962f2_1602633141819_29294&reqParam=%7B%22from%22%3A0%2C%22sessionid%22%3A%22%22%2C%22siteId%22%3A%221050923%22%2C%22tid%22%3A%22-1%22%2C%22userId%22%3A%223244648%22%2C%22ttype%22%3A1%2C%22siteConfig%22%3A%7B%22eid%22%3A%223244648%22%2C%22queuing%22%3A%22%22%2C%22siteToken%22%3A%22fa9edd6c146a2526c2a20e5302b32e57%22%2C%22userId%22%3A%223244648%22%2C%22isGray%22%3A%22false%22%2C%22wsUrl%22%3A%22wss%3A%2F%2Fp.qiao.baidu.com%2Fcps4%2Fwebsocket%22%2C%22likeVersion%22%3A%22generic%22%2C%22siteId%22%3A%221050923%22%2C%22online%22%3A%22true%22%2C%22webRoot%22%3A%22%2F%2Fp.qiao.baidu.com%2Fcps4%2F%22%2C%22bid%22%3A%22158519076548463203%22%2C%22isSmallFlow%22%3A0%2C%22isPreonline%22%3A0%2C%22invited%22%3A0%7D%2C%22config%22%3A%7B%22themeColor%22%3A%224d74fa%22%7D%7D">在线咨询</a>
              <?php endif; ?>
              <?php if($gg['price'] > 0): ?>
                <a target="_blank"><?php echo $gg['price']; ?></a>
              <?php endif; ?>
            </td>
            <td style="white-space: nowrap;font-size: 12px;" align="center"><?php echo $gg['pkg'];?></td>
            <!--<td align="center"><?php echo $gg['stock']>0?'':'';?><?php echo stock_show($gg);?></td>-->
            <?php 
            if($gk%2 == 0):
          ?>
          <td style="white-space: nowrap;font-size: 12px;border: none;outline-color: #b6b6b6;outline-width: 1px;outline-style: dotted;position: sticky;right: 108px;background-color: rgb(246, 246, 246);" align="center" class="t2r">
<?php if($_SESSION[SESSION_PREFIX]['username']<>""){ ?>
          <div class="roption">
                <ul>
                  <li> <a href="javascript:void(0);" class="reduce" onclick="reduceBuyNum(<?php echo $gg['pd_id'];?>);">-</a>
                    <input type="text" id="<?php echo $gg['pd_id'];?>" class="pcsnum" pkg="<?php echo $gg['pkg'];?>" value="<?php echo $gg['pkg'];?>" stock="<?php echo $gg['stock'];?>" delivery="<?php echo $gg['delivery'];?>">
                    <a href="javascript:void(0);" class="increase" onclick="increaseBuyNum(<?php echo $gg['pd_id'];?>);">+</a> </li>
                  <li>
                    <span style="font-size: 14px;color: #E90211;font-family: Microsoft YaHei;cursor: pointer;" onclick="addToShopCart(<?php echo $gg['pd_id'];?>);">加入购物车</span>
                  </li>
                </ul>
              </div>
<?php } ELSE { ?>
<DIV style="text-align:center;font-size:12px;color:#999999;"><?php  echo "尚未登录"; ?></div>
<?php }?>
              </td>
              <?php if($has3D == true): ?>
              <td style="white-space: nowrap;font-size: 12px;border: none;outline-color: #b6b6b6;outline-width: 1px;outline-style: dotted;position: sticky;right: 55px;background-color: rgb(246, 246, 246);" align="center" class="t2r"> <span class="img1" @click="showImg('<?php echo $gg['sku']?>')" ></span></td>
              <td style="white-space: nowrap;font-size: 12px;border: none;outline-color: #b6b6b6;outline-width: 1px;outline-style: dotted;position: sticky;right: 1px;background-color: rgb(246, 246, 246);" align="center" class="t2r"> <span class="img2" @click="downLoad('<?php echo $gg['sku']?>')" >下载</span> </td>
              <?php endif; ?>
              <?php if($has3D == false): ?>
              <td style="white-space: nowrap;font-size: 12px;border: none;outline-color: #b6b6b6;outline-width: 1px;outline-style: dotted;position: sticky;right: 1px;background-color: rgb(246, 246, 246);" align="center" class="t2r"> <span class="img2" @click="downLoad('<?php echo $gg['sku']?>')" >我要申请</span> </td>
              <?php endif; ?>
          <?php 
          endif;
          ?>
          <?php 
            if($gk%2 != 0):
          ?>
          <td style="white-space: nowrap;font-size: 12px;border: none;outline-color: #b6b6b6;outline-width: 1px;outline-style: dotted;position: sticky;right: 108px;background-color: rgb(238, 238, 238);" align="center" class="t2r"><?php if($_SESSION[SESSION_PREFIX]['username']<>""){ ?>
          <div class="roption">
                <ul>
                  <li> <a href="javascript:void(0);" class="reduce" onclick="reduceBuyNum(<?php echo $gg['pd_id'];?>);">-</a>
                    <input type="text" id="<?php echo $gg['pd_id'];?>" class="pcsnum" pkg="<?php echo $gg['pkg'];?>" value="<?php echo $gg['pkg'];?>" stock="<?php echo $gg['stock'];?>" delivery="<?php echo $gg['delivery'];?>">
                    <a href="javascript:void(0);" class="increase" onclick="increaseBuyNum(<?php echo $gg['pd_id'];?>);">+</a> </li>
                  <li>
                    <span style="font-size: 14px;color: #E90211;font-family: Microsoft YaHei;cursor: pointer;" onclick="addToShopCart(<?php echo $gg['pd_id'];?>);">加入购物车</span>
                  </li>
                </ul>
              </div>
<?php } ELSE { ?>
<DIV style="text-align:center;font-size:12px;color:#999999;"><?php echo "尚未登录";?></div>
<?php }?></td>
              <?php if($has3D == true): ?>
              <td style="border: none;outline-color: #b6b6b6;outline-width: 1px;outline-style: dotted;position: sticky;right: 55px;background-color: rgb(238, 238, 238);" align="center" class="t2r"> <span class="img1" @click="showImg('<?php echo $gg['sku']?>')" ></span></td>
              <td style="border: none;outline-color: #b6b6b6;outline-width: 1px;outline-style: dotted;position: sticky;right: 1px;background-color: rgb(238, 238, 238);" align="center" class="t2r"> <span class="img2" @click="downLoad('<?php echo $gg['sku']?>')" >下载</span> </td>
              <?php endif; ?>
              <?php if($has3D == false): ?>
              <td style="white-space: nowrap;font-size: 12px;border: none;outline-color: #b6b6b6;outline-width: 1px;outline-style: dotted;position: sticky;right: 1px;background-color: rgb(246, 246, 246);" align="center" class="t2r"> <span class="img2" @click="downLoad('<?php echo $gg['sku']?>')" >我要申请</span> </td>
              <?php endif; ?>
          <?php 
          endif;
          ?>
          
            </tr>
          <?php
	$leo=$leo+1;	  
    endforeach;
	endif;
	?>
        </table>
      </form>
    </div>
    <!--s 规格列表 gg_box-->
                        
                        </div>
                    </div>

                    <?php 
                    //列表
                    if(count($txt_list)){
                    ?>
                    <?php $ipt=0;foreach($txt_list as $key => $list): $ipt++;?>
                    <div style="padding: 30px;display: none;" id="proDetail_content_block_<?php echo $key; ?>" class="proDetail_content_block box proDetail_content_block_xinghao" style="display: none;">
                        <div class="basic_infor">
                            <p>
                                <?php echo $list['detail'];?> 
                            </p>
                        </div>
                    </div>
                    <?php endforeach; ?>
                    <?php }?>
                </div>

                <?php
                        $product_id = (isset($_GET['id'])&&$_GET['id']>0)?$_GET['id']:0;
                        $sql = "SELECT *,if(`sort_order` > '0',1,0) AS `is_order` FROM `product_pic` WHERE `product_id`='".$product_id."' AND `ftype` IN (2,3,5) ORDER BY `is_order` DESC, `sort_order`;";
                        $pic_list = $db->getAll($sql);

                        $model_id = $product['model_id'];
                        $sql = "SELECT * FROM `product_model_pic` WHERE `model_id`='".$model_id."' and `ftype`='2';";
                        $model3d = $db->getAll($sql);
                        if(!empty($pic_list) || !empty($model3d)):?>

                <div class="about_resources box">
                    <h3>相关资源</h3>
                    <ul>
                        

                                    <?php if(!empty($pic_list)): ?>
                                    <?php  $ik=0;foreach($pic_list as $key => $list): $ik++;?>
                                    <?php if($list['pic']<>""){?>
                                    <?php 
                                        if($_SESSION[SESSION_PREFIX]['user_id']){  
                                            $url = $domain.'/upload'.$list['pic'];
                                    ?>
                                    <li><a href="<?=$url;?>" target="_blank">
                                    <?php echo $list['title']==''?'无':$list['title'];?>
                                    <?php if ($list['title']!=''):?>
                                      <span style='background-color: #FFB901!important;margin-left: 10px;' class="layui-badge layui-bg-gray">下载</span>
                                    <?php endif;?>
                                    </a></li>
                                    <?php
                                        }else{ $url = $domain.'/upload'.$list['pic']; ?>
                                    <li>
                                      <a onclick="showLoginDialog()" target="_blank">
                                      <!-- <a  href="javascript:void(0);" id="click_msg_login<?php echo $ik;?>"> -->
                                    <?php echo $list['title']==''?'无':$list['title'];?>
                                    <?php if ($list['title']!=''):?>
                                      <span style='background-color: #FFB901!important;margin-left: 10px;' class="layui-badge layui-bg-gray">下载</span>
                                    <?php endif;?>
                                    </a></li>
                                    <?php  }  ?>
                                    <?php }?>
                                    <?php endforeach; /* */?>
                                    <?php endif;?>

                                    <!--model-->
                                    <?php if(!empty($model3d)):?>
                                    <?php  foreach($model3d as $key => $modelarr):?>
                                        <li><a onclick="winopen('三维图展示','<?php echo $domain?>/3d.164580.com/index.php?3dfile=www.pentalink.com/upload<?php echo $modelarr['pic']; ?>','700px','620px')"><?php echo $modelarr['title']<>""?$modelarr['title']." <span style='background-color: #FFB901!important;margin-left: 10px;' class=\"layui-badge layui-bg-gray\">演示</span>":"3D展示";?></a></li>
                                    <?php endforeach;?>
                                    <?php endif;?>
                                </div>
                                </div>
                            </fieldset>
                            </div>
                    </ul>
                </div>
                <?php endif;?>

            </div>     
            <?php include('./footer.php');?>
<script type="text/javascript" src="/static/layui/layui.js"></script> 
<script type="text/javascript" src="/js/layw.js"></script>
<script>
    var galleryTop = new Swiper('.gallery-top', {
        allowSlidePrev: true,
        thumbs: {
            swiper: galleryThumbs,
        },
    });
    var galleryThumbs = new Swiper('.gallery-thumbs', {
        slidesPerView: 1,
        spaceBetween: 5,
        centeredSlides: false,
        slidesPerView: 'auto',
        touchRatio: 0.2,
        slideToClickedSlide: true,
        //nextButton: '.swiper-button-next',
        //prevButton: '.swiper-button-prev',
    });
    galleryTop.params.control = galleryThumbs;
    galleryThumbs.params.control = galleryTop;

</script>
<script src="https://unpkg.com/vue@2/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>


<script>


    var userId = "<?php echo $_SESSION[SESSION_PREFIX]['user_id']; ?>"
    var skuList = []
    <?php
    if(!empty($gg_list)):
	foreach($gg_list as $gk => $gg):
	?>
    var item = {
        value: "<?php echo $gg['sku']; ?>",
        label: "<?php echo $gg['sku']; ?>"
    }
    skuList.push(item)
    <?php
    endforeach;
	endif;
	?>
    new Vue({
      el: '#app',
      data: function() {
        return { 
            options2: [
              {
                value: '3DSTUDIOMAX',
                label: '3D Studio MAX'
              },
              {
                value: 'ARCHICADGSM',
                label: 'ARCHICAD GSM>=17'
              },
              {
                value: 'ARCHICADGSMMESH',
                label: 'ARCHICAD GSM(Mesh)>=17'
              },
              {
                value: 'ARCHICAD',
                label: 'ARCHICAD GDL>=19'
              },
              {
                value: 'ASCON_C3D',
                label: 'ASCON C3D'
              },
              {
                value: 'M3DPDMS',
                label: 'AVEVA E3D'
              },
              {
                value: 'ALLPLANXML3D',
                label: 'Allplan Macro'
              },
              {
                value: 'ALLPLANIFC3D',
                label: 'Allplan(via IFC)'
              },
              {
                value: 'ACAD3D',
                label: 'AutoCAD >=V14'
              },
              {
                value: 'CADMEP',
                label: 'Autodesk Fabrication CADmep'
              },
              {
                value: 'REVIT_2023',
                label: 'Autodesk Revit 2023'
              },
              {
                value: 'REVIT_2022',
                label: 'Autodesk Revit 2022'
              },
              {
                value: 'REVIT_2021',
                label: 'Autodesk Revit 2021'
              },
              {
                value: 'REVIT_2020',
                label: 'Autodesk Revit 2020'
              },
              {
                value: 'REVIT_2019',
                label: 'Autodesk Revit 2019'
              },
              {
                value: 'AML',
                label: 'AutomationML'
              },
              {
                value: 'BECKERCAD',
                label: 'BeckerCAD'
              },
              {
                value: 'AECOMSIM',
                label: 'Bentley AECOsim'
              },
              {
                value: 'BRICSCAD',
                label: 'Bricscad(via DWG)'
              },
              {
                value: 'KOMPAS',
                label: 'C3D KOMPAS'
              },
              {
                value: 'RENGA',
                label: 'C3D RENGA'
              },
              {
                value: 'COLLADA',
                label: 'COLLADA'
              },
              {
                value: 'Ziegler',
                label: 'Caddy++ SAT-V4.2'
              },
              {
                value: 'CATIAV5',
                label: 'Catia >=V5'
              },
              {
                value: 'CATV5MAC',
                label: 'Catia(Macro)>=V5'
              },
              {
                value: 'm3d_sd_cc2007',
                label: 'CoCreate Modeling >=2007'
              },
              {
                value: 'm3d_sd_creo17',
                label: 'Creo Elements/Direct Modeling >=17.0'
              },
              {
                value: 'CREO9',
                label: 'Creo Parametric 9'
              },
              {
                value: 'CREO8',
                label: 'Creo Parametric 8'
              },
              {
                value: 'CREO7',
                label: 'Creo Parametric 7'
              },
              {
                value: 'CREO6',
                label: 'Creo Parametric 6'
              },
              {
                value: 'CREO5',
                label: 'Creo Parametric 5'
              },
              {
                value: 'DWG3D-2013',
                label: 'DWG AUTOCAD VERSION 2013'
              },
              {
                value: 'DWG3D-2010',
                label: 'DWG AUTOCAD VERSION 2010-2012'
              },
              {
                value: 'DWG3D-2007',
                label: 'DWG AUTOCAD VERSION 2007-2009'
              },
              {
                value: 'DWG3D-2004',
                label: 'DWG AUTOCAD VERSION 2004-2006'
              },
              {
                value: 'DXF3D-2013',
                label: 'DXF AUTOCAD VERSION 2013'
              },
              {
                value: 'DXF3D-2010',
                label: 'DXF AUTOCAD VERSION 2010-2012'
              },
              {
                value: 'DXF3D-2007',
                label: 'DXF AUTOCAD VERSION 2007-2009 '
              },
              {
                value: 'DXF3D-2004',
                label: 'DXF AUTOCAD VERSION 2004-2006 '
              },
              {
                value: 'FBX',
                label: 'FBX(Filmbox)'
              },
              {
                value: 'FBX_EXTRA',
                label: 'FBX with additional data'
              },
              {
                value: 'IFCMESH',
                label: 'IFC2x mesh'
              },
              {
                value: 'IFCMAC',
                label: 'IFC2x Edition 3'
              },
              {
                value: 'IGES',
                label: 'IGES'
              },
              {
                value: 'AIS2023',
                label: 'Inventor 2023'
              },
              {
                value: 'AIS2022',
                label: 'Inventor 2022'
              },
              {
                value: 'AIS2021',
                label: 'Inventor 2021'
              },
              {
                value: 'AIS2020',
                label: 'Inventor 2020'
              },
              {
                value: 'AIS2019',
                label: 'Inventor 2019'
              },
              {
                value: 'EAI',
                label: 'JT'
              },
              {
                value: 'MD3DMACRO',
                label: 'Mechanical Desktop >=V5'
              },
              {
                value: 'MegaCAD',
                label: 'MegaCAD SAT-V2.0'
              },
              {
                value: 'meta3DV2',
                label: 'Metafile 3D (PS3)V2'
              },
              {
                value: 'DWG3D_MICROSTATION',
                label: 'Microstation (3D)'
              },
              {
                value: 'UG3DNX12',
                label: 'NX>=12'
              },
              {
                value: 'UG3DNX2206',
                label: 'NX 2206'
              },
              {
                value: 'UG3DNX1980',
                label: 'NX 1980'
              },
              {
                value: 'UG3DNX1953',
                label: 'NX 1953'
              },
              {
                value: 'UG3DNX1926',
                label: 'NX 1926'
              },
              {
                value: 'UG3DNX1899',
                label: 'NX 1899'
              },
              {
                value: 'UG3DNX1872',
                label: 'NX 1872'
              },
              {
                value: 'UG3DNX1847',
                label: 'NX 1847'
              },
              {
                value: 'OBJFILE',
                label: 'OBJ(WaveFront)'
              },
              {
                value: 'm3d_sd',
                label: 'One Space Modeling >=2007'
              },
              {
                value: 'PARTjava',
                label: 'PARTjava'
              },
              {
                value: 'PDF',
                label: 'PDF 3D 7.01'
              },
              {
                value: 'PRODMAC',
                label: 'PRO-Desktop'
              },
              {
                value: 'XT-90',
                label: 'Parasolid Text V15'
              },
              {
                value: 'XB-90',
                label: 'Parasolid Binary V15'
              },
              {
                value: 'SAT-700',
                label: 'SAT 7.0'
              },
              {
                value: 'STEP-2.14',
                label: 'STEP AP214'
              },
              {
                value: 'STEP-2.03',
                label: 'STEP AP203'
              },
              {
                value: 'STL',
                label: 'STL'
              },
              {
                value: 'SE_3D_2022',
                label: 'Solid Edge 2022'
              },
              {
                value: 'SE_3D_2021',
                label: 'Solid Edge 2021'
              },
              {
                value: 'SE_3D_2020',
                label: 'Solid Edge 2020'
              },
              {
                value: 'SE_3D_2019',
                label: 'Solid Edge 2019'
              },
              {
                value: 'SOLIDWORKS',
                label: 'SolidWorks >=2006'
              },
              {
                value: 'SW_MAC',
                label: 'SolidWorks(Macro)>=2001+'
              },
              {
                value: 'STRAKON_MAC',
                label: 'Strakon complex'
              },
              {
                value: 'STRAKON_MESH',
                label: 'Strakon simple'
              },
              {
                value: 'SKETCHUP2017',
                label: 'Trimble Sketchup 2017'
              },
              {
                value: 'USDZ',
                label: 'USDZ'
              },
              {
                value: 'VRML',
                label: 'VRML=V1.0'
              },
              {
                value: 'GLTF',
                label: 'gITF(GLB)'
              },
            ],
            plant: "3D Studio MAX",
            arr2D: [
              {
                value: 'ANIMGIF-640x480',
                label: 'Animated GIF 640x480'
              },
              {
                value: 'ANIMGIFFILE-640x480',
                label: 'Animated GIF'
              },
              {
                value: 'BMP2D',
                label: 'BMP (2D View)'
              },
              {
                value: 'BMPFILE',
                label: 'BMP (3D View)'
              },
              {
                value: 'BOMEXPORTXML',
                label: 'Bill of material XML'
              },
              {
                value: 'BOMEXPORTJSON',
                label: 'Bill of material JSON'
              },
              {
                value: 'CAPITALXML',
                label: 'Capital XML'
              },
              {
                value: 'DWF2D-B6.0',
                label: 'DWF V6, UNCOMPRESSED BINARY'
              },
              {
                value: 'DWF2D-A6.0',
                label: 'DWF DWF V6, ASCII'
              },
              {
                value: 'DWF2D-C5.5',
                label: 'DWF Compressed 5.5'
              },
              {
                value: 'DWF2D-B5.5',
                label: 'DWF Binary 5.5'
              },
              {
                value: 'DWF2D-A5.5',
                label: 'DWF ASCII 5.5'
              },
              {
                value: 'DWG2D-2013',
                label: 'DWG AUTOCAD VERSION 2013'
              },
              {
                value: 'DWG2D-2010',
                label: 'DWG AUTOCAD VERSION 2010 - 2012'
              },
              {
                value: 'DWG2D-2007',
                label: 'DWG AUTOCAD VERSION 2007 - 2009'
              },
              {
                value: 'DWG2D-2004',
                label: 'DWG AUTOCAD VERSION 2004 - 2006'
              },
              {
                value: 'DXF2D-2013',
                label: 'DXF AUTOCAD VERSION 2013'
              },
              {
                value: 'DXF2D-2010',
                label: 'DXF AUTOCAD VERSION 2010 - 2012'
              },
              {
                value: 'DXF2D-2007',
                label: 'DXF AUTOCAD VERSION 2007 - 2009'
              },
              {
                value: 'DXF2D-2004',
                label: 'DXF AUTOCAD VERSION 2004 - 2006'
              },
              {
                value: 'ME10',
                label: 'HP ME 10>=V9'
              },
              {
                value: 'HPGL2',
                label: 'HPGL V2'
              },
              {
                value: 'JPG2D',
                label: 'JPEG (2D View)'
              },
              {
                value: 'JPEGFILE',
                label: 'JPEG (3D View)'
              },
              {
                value: 'MI',
                label: 'MI>=V8'
              },
              {
                value: 'meta',
                label: 'Metafile  2D  V1'
              },
              {
                value: 'META2DV2',
                label: 'Metafile 2D (PS2)V2'
              },
              {
                value: 'DGN2D',
                label: 'Microstation(DGN)>=V8'
              },
              {
                value: 'PDFDATASHEET',
                label: 'PDF Datasheet'
              },
              {
                value: 'SVG',
                label: 'SVG'
              },
              {
                value: 'TIFF2D',
                label: 'TIFF (2D View)'
              },
              {
                value: 'GAEBDOCX',
                label: 'Tendering text Word'
              },
              {
                value: 'GAEBDAXML',
                label: 'Tendering text GAEB XML'
              },
              {
                value: 'GAEB90',
                label: 'Tendering text GAEB 90'
              },
              
            ],
            arr3D: [
              {
                value: '3DSTUDIOMAX',
                label: '3D Studio MAX'
              },
              {
                value: 'ARCHICADGSM',
                label: 'ARCHICAD GSM>=17'
              },
              {
                value: 'ARCHICADGSMMESH',
                label: 'ARCHICAD GSM(Mesh)>=17'
              },
              {
                value: 'ARCHICAD',
                label: 'ARCHICAD GDL>=19'
              },
              {
                value: 'ASCON_C3D',
                label: 'ASCON C3D'
              },
              {
                value: 'M3DPDMS',
                label: 'AVEVA E3D'
              },
              {
                value: 'ALLPLANXML3D',
                label: 'Allplan Macro'
              },
              {
                value: 'ALLPLANIFC3D',
                label: 'Allplan(via IFC)'
              },
              {
                value: 'ACAD3D',
                label: 'AutoCAD >=V14'
              },
              {
                value: 'CADMEP',
                label: 'Autodesk Fabrication CADmep'
              },
              {
                value: 'REVIT_2023',
                label: 'Autodesk Revit 2023'
              },
              {
                value: 'REVIT_2022',
                label: 'Autodesk Revit 2022'
              },
              {
                value: 'REVIT_2021',
                label: 'Autodesk Revit 2021'
              },
              {
                value: 'REVIT_2020',
                label: 'Autodesk Revit 2020'
              },
              {
                value: 'REVIT_2019',
                label: 'Autodesk Revit 2019'
              },
              {
                value: 'AML',
                label: 'AutomationML'
              },
              {
                value: 'BECKERCAD',
                label: 'BeckerCAD'
              },
              {
                value: 'AECOMSIM',
                label: 'Bentley AECOsim'
              },
              {
                value: 'BRICSCAD',
                label: 'Bricscad(via DWG)'
              },
              {
                value: 'KOMPAS',
                label: 'C3D KOMPAS'
              },
              {
                value: 'RENGA',
                label: 'C3D RENGA'
              },
              {
                value: 'COLLADA',
                label: 'COLLADA'
              },
              {
                value: 'Ziegler',
                label: 'Caddy++ SAT-V4.2'
              },
              {
                value: 'CATIAV5',
                label: 'Catia >=V5'
              },
              {
                value: 'CATV5MAC',
                label: 'Catia(Macro)>=V5'
              },
              {
                value: 'm3d_sd_cc2007',
                label: 'CoCreate Modeling >=2007'
              },
              {
                value: 'm3d_sd_creo17',
                label: 'Creo Elements/Direct Modeling >=17.0'
              },
              {
                value: 'CREO9',
                label: 'Creo Parametric 9'
              },
              {
                value: 'CREO8',
                label: 'Creo Parametric 8'
              },
              {
                value: 'CREO7',
                label: 'Creo Parametric 7'
              },
              {
                value: 'CREO6',
                label: 'Creo Parametric 6'
              },
              {
                value: 'CREO5',
                label: 'Creo Parametric 5'
              },
              {
                value: 'DWG3D-2013',
                label: 'DWG AUTOCAD VERSION 2013'
              },
              {
                value: 'DWG3D-2010',
                label: 'DWG AUTOCAD VERSION 2010-2012'
              },
              {
                value: 'DWG3D-2007',
                label: 'DWG AUTOCAD VERSION 2007-2009'
              },
              {
                value: 'DWG3D-2004',
                label: 'DWG AUTOCAD VERSION 2004-2006'
              },
              {
                value: 'DXF3D-2013',
                label: 'DXF AUTOCAD VERSION 2013'
              },
              {
                value: 'DXF3D-2010',
                label: 'DXF AUTOCAD VERSION 2010-2012'
              },
              {
                value: 'DXF3D-2007',
                label: 'DXF AUTOCAD VERSION 2007-2009 '
              },
              {
                value: 'DXF3D-2004',
                label: 'DXF AUTOCAD VERSION 2004-2006 '
              },
              {
                value: 'FBX',
                label: 'FBX(Filmbox)'
              },
              {
                value: 'FBX_EXTRA',
                label: 'FBX with additional data'
              },
              {
                value: 'IFCMESH',
                label: 'IFC2x mesh'
              },
              {
                value: 'IFCMAC',
                label: 'IFC2x Edition 3'
              },
              {
                value: 'IGES',
                label: 'IGES'
              },
              {
                value: 'AIS2023',
                label: 'Inventor 2023'
              },
              {
                value: 'AIS2022',
                label: 'Inventor 2022'
              },
              {
                value: 'AIS2021',
                label: 'Inventor 2021'
              },
              {
                value: 'AIS2020',
                label: 'Inventor 2020'
              },
              {
                value: 'AIS2019',
                label: 'Inventor 2019'
              },
              {
                value: 'EAI',
                label: 'JT'
              },
              {
                value: 'MD3DMACRO',
                label: 'Mechanical Desktop >=V5'
              },
              {
                value: 'MegaCAD',
                label: 'MegaCAD SAT-V2.0'
              },
              {
                value: 'meta3DV2',
                label: 'Metafile 3D (PS3)V2'
              },
              {
                value: 'DWG3D_MICROSTATION',
                label: 'Microstation (3D)'
              },
              {
                value: 'UG3DNX12',
                label: 'NX>=12'
              },
              {
                value: 'UG3DNX2206',
                label: 'NX 2206'
              },
              {
                value: 'UG3DNX1980',
                label: 'NX 1980'
              },
              {
                value: 'UG3DNX1953',
                label: 'NX 1953'
              },
              {
                value: 'UG3DNX1926',
                label: 'NX 1926'
              },
              {
                value: 'UG3DNX1899',
                label: 'NX 1899'
              },
              {
                value: 'UG3DNX1872',
                label: 'NX 1872'
              },
              {
                value: 'UG3DNX1847',
                label: 'NX 1847'
              },
              {
                value: 'OBJFILE',
                label: 'OBJ(WaveFront)'
              },
              {
                value: 'm3d_sd',
                label: 'One Space Modeling >=2007'
              },
              {
                value: 'PARTjava',
                label: 'PARTjava'
              },
              {
                value: 'PDF',
                label: 'PDF 3D 7.01'
              },
              {
                value: 'PRODMAC',
                label: 'PRO-Desktop'
              },
              {
                value: 'XT-90',
                label: 'Parasolid Text V15'
              },
              {
                value: 'XB-90',
                label: 'Parasolid Binary V15'
              },
              {
                value: 'SAT-700',
                label: 'SAT 7.0'
              },
              {
                value: 'STEP-2.14',
                label: 'STEP AP214'
              },
              {
                value: 'STEP-2.03',
                label: 'STEP AP203'
              },
              {
                value: 'STL',
                label: 'STL'
              },
              {
                value: 'SE_3D_2022',
                label: 'Solid Edge 2022'
              },
              {
                value: 'SE_3D_2021',
                label: 'Solid Edge 2021'
              },
              {
                value: 'SE_3D_2020',
                label: 'Solid Edge 2020'
              },
              {
                value: 'SE_3D_2019',
                label: 'Solid Edge 2019'
              },
              {
                value: 'SOLIDWORKS',
                label: 'SolidWorks >=2006'
              },
              {
                value: 'SW_MAC',
                label: 'SolidWorks(Macro)>=2001+'
              },
              {
                value: 'STRAKON_MAC',
                label: 'Strakon complex'
              },
              {
                value: 'STRAKON_MESH',
                label: 'Strakon simple'
              },
              {
                value: 'SKETCHUP2017',
                label: 'Trimble Sketchup 2017'
              },
              {
                value: 'USDZ',
                label: 'USDZ'
              },
              {
                value: 'VRML',
                label: 'VRML=V1.0'
              },
              {
                value: 'GLTF',
                label: 'gITF(GLB)'
              },
            ],
            check1: true,
            check2: true,
            loading: false,
            skuText: "",
            note: "",
            fromDialog:false,
            centerDialogVisible: false,
            downPage: false,
            options: [{
                value: '3D',
                label: '3D'
                },{
                value: '2D',
                label: '2D'
                }],
            options1: skuList,
            value: "3D",
            sku: "",
            url1: "",
            url2: ""
         }
      },
      created(e) {
        if (skuList.length > 0){
            this.sku = skuList[0].value
            this.skuText = this.sku
            this.url1 = "https://evan-embedded.partcommunity.com?catalog=evan&partFixed=false&part=" + skuList[0].value
            //this.url1 = "https://evan-embedded.partcommunity.com/3d-cad-models/sso/?showportlets=preview&catalog=evan&hideportlets=navigation&hideportlets=generation&part=" + skuList[0].value
            //this.url2 = "https://evan-embedded.partcommunity.com/3d-cad-models/sso/?showportlets=navigation&catalog=evan&hideportlets=preview&hideportlets=generation&part=" + skuList[0].value
        }

        //获取url
        let url = window.location.href
        let urlInfo = url.split("?")[1]
        let dialog = new URLSearchParams('?' + urlInfo).get("showDialog")
        let sku = new URLSearchParams('?' + urlInfo).get("sku")
        if (sku != null && sku != "" && sku != undefined){
            this.sku = sku
            this.skuText = this.sku
        }
        if(dialog == "3D"){
            this.centerDialogVisible = true
        }
        if(dialog == "downLoad"){
            this.centerDialogVisible = true
            this.downPage = true
        }
        if(dialog == "form"){
            //表单填写弹窗
            this.fromDialog = true
        }
      },
      methods: {
        changeSelect1(type){
          if(type == "2D"){
            this.options2 = this.arr2D
          }else{
            this.options2 = this.arr3D
          }
          console.log("change")
          this.plant = this.options2[0].value
        },
        saveSeek(){
          if(this.skuText == ""){
            this.$message.error('请填写零件号');
            return
          }
          let that = this
          $.post("/ajax/skuSeek.php", { "sku": this.skuText, "note":this.note }, function(data) {
            data = JSON.parse(data)
            if (data.code == 200){
              that.$message({
                message: '提交成功',
                type: 'success'
              });
            }else if (data.code == 201){
              that.$message.error(data.msg);
            }
            that.fromDialog = false
          })
        },
        downLoadNow(){
            if(userId == 0){
                var url = ""
                if(window.location.href.indexOf("?") > 0){
                    url =  window.location.href + "$$showDialog=downLoad$$sku=" + this.sku
                }else{
                    url =  window.location.href + "?showDialog=downLoad$$sku=" + this.sku
                }
                //location.href = "/member/login.php?url=" + url
                $(".login_alert_block").show()
            }else{
                this.downPage = true
            }
        },
        downLoad(sku) {
            this.loading = true
            let that = this
            $.post("/ajax/img3D.php", { "sku": sku }, function(data) {
                data = JSON.parse(data)
                that.loading = false
                if(userId == 0){
                    if(data.code == 200){
                        var url = ""
                        if(window.location.href.indexOf("?") > 0){
                            url =  window.location.href + "$$showDialog=downLoad$$sku=" + sku
                        }else{
                            url =  window.location.href + "?showDialog=downLoad$$sku=" + sku
                        }
                        //location.href = "/member/login.php?url=" + url
                        $(".login_alert_block").show()
                    }else if(data.code == 201){
                        //跳转到登录页面，并回传from弹窗
                        var url = ""
                        if(window.location.href.indexOf("?") > 0){
                            url =  window.location.href + "$$showDialog=form$$sku=" + sku
                        }else{
                            url =  window.location.href + "?showDialog=form$$sku=" + sku
                        }
                        //location.href = "/member/login.php?url=" + url
                        $(".login_alert_block").show()
                    }
                }else{
                    if(data.code == 200){
                        that.url1 = "https://evan-embedded.partcommunity.com?catalog=evan&partFixed=false&part=" + sku
                        //that.url1 = "https://evan-embedded.partcommunity.com/3d-cad-models/sso/?showportlets=preview&catalog=evan&hideportlets=navigation&hideportlets=generation&part=" + sku
                        //that.url2 = "https://evan-embedded.partcommunity.com/3d-cad-models/sso/?showportlets=navigation&catalog=evan&hideportlets=preview&hideportlets=generation&part=" + sku
                        that.sku = sku
                        that.skuText = that.sku
                        that.centerDialogVisible = true
                        that.downPage = true
                    }else if(data.code == 201){
                        //弹出填写问题的弹窗
                        that.fromDialog = true
                    }   
                }
                
            })
        },
        showImg(sku){
            this.downPage = false
            let that = this
            this.loading = true
            $.post("/ajax/img3D.php", { "sku": sku }, function(data) {
                data = JSON.parse(data)
                that.loading = false
                if(userId == 0){
                    if(data.code == 200){
                        that.url1 = "https://evan-embedded.partcommunity.com?catalog=evan&partFixed=false&part=" + sku
                        //that.url1 = "https://evan-embedded.partcommunity.com/3d-cad-models/sso/?showportlets=preview&catalog=evan&hideportlets=navigation&hideportlets=generation&part=" + sku
                        //that.url2 = "https://evan-embedded.partcommunity.com/3d-cad-models/sso/?showportlets=navigation&catalog=evan&hideportlets=preview&hideportlets=generation&part=" + sku
                        that.sku = sku
                        that.centerDialogVisible = true
                    }else if(data.code == 201){
                        //跳转到登录页面，并回传from弹窗
                        var url = ""
                        if(window.location.href.indexOf("?") > 0){
                            url =  window.location.href + "$$showDialog=form$$sku=" + sku
                        }else{
                            url =  window.location.href + "?showDialog=form$$sku=" + sku
                        }
                        //location.href = "/member/login.php?url=" + url
                        $(".login_alert_block").show()
                    }
                }else{
                    if(data.code == 200){
                        that.url1 = "https://evan-embedded.partcommunity.com?catalog=evan&partFixed=false&part=" + sku
                        //that.url1 = "https://evan-embedded.partcommunity.com/3d-cad-models/sso/?showportlets=preview&catalog=evan&hideportlets=navigation&hideportlets=generation&part=" + sku
                        //that.url2 = "https://evan-embedded.partcommunity.com/3d-cad-models/sso/?showportlets=navigation&catalog=evan&hideportlets=preview&hideportlets=generation&part=" + sku
                        that.sku = sku
                        that.skuText = that.sku
                        that.centerDialogVisible = true
                    }else if(data.code == 201){
                        //弹出填写问题的弹窗
                        that.fromDialog = true
                    }   
                }
                
            })

        },
        downLoadImage(){
          if(!this.check1 || !this.check2){
              this.$message.error('请先勾选协议');
              return;
          }
          let that = this
          $.post("/ajax/downLoad.php", { "sku": this.sku, type: this.plant }, function(data) {
                data = JSON.parse(data)
                if(data.code == 200){
                  location.href = data.url
                }else{
                  that.$message.error('无此规格的文件');
                }
            })
        },
        changeSelect(sku){
            this.url1 = "https://evan-embedded.partcommunity.com?catalog=evan&partFixed=false&part=" + sku
            //this.url1 = "https://evan-embedded.partcommunity.com/3d-cad-models/sso/?showportlets=preview&catalog=evan&hideportlets=navigation&hideportlets=generation&part=" + sku
            //this.url2 = "https://evan-embedded.partcommunity.com/3d-cad-models/sso/?showportlets=navigation&catalog=evan&hideportlets=preview&hideportlets=generation&part=" + sku
        }
      }
    });
  </script>

<script type="text/javascript" src="/js/artDialog4.1.7/artDialog.js?skin=blue"></script> 
<script>
    function submitForm(){
        var form = document.getElementById("myform");
        form.submit();
    }
    $(".proDetail_content_nav li").click(function(){
        var className = $(this).attr("class")
        if (className.indexOf("act") >= 0){
          return
        }
        $(".proDetail_content_nav li").removeClass("act")
        $(this).addClass("act")
        if($(this).text() == "规格型号表"){
            $(".xinghao").show()
            $(".proDetail_content_block_xinghao").hide()
        }else{
            $(".xinghao").hide()
            $(".proDetail_content_block_xinghao").hide()
            $("#" + className).show()
        }
        
    })

  
//减少采购数量，范例reduceBuyNum(1678)
function reduceBuyNum(pid)
{
    var txt = document.getElementById(pid);
    var pkg = parseInt(txt.getAttribute('pkg'), 10);
    var cvalue = parseInt(txt.value, 10);
    if (cvalue % pkg != 0) {
        //alert('请按包装量 '+pkg+' 的倍数购买!!比如：'+pkg+'*3='+pkg*3+'个。');
		art.dialog({
			content: '请按包装量 '+pkg+' 的倍数购买!!比如：'+pkg+'*3='+pkg*3+'个。',
			time: 3,
			opacity: 0.2,	// 透明度
			title: '系统提示（3秒后自动关闭）',
			icon: 'warning',
			ok: true,
			lock: true,
            fixed: true,
            top: "200px",
		});
        return false;
    }
    cvalue = cvalue - pkg;
    if (cvalue <= 0) {
        //alert('购买数量必须大于等于最小包装量'+pkg+'!');
		
		art.dialog({
			content: '购买数量必须大于等于最小包装量'+pkg+'!',
			time: 3,
			opacity: 0.2,	// 透明度
			title: '系统提示（3秒后自动关闭）',
			icon: 'warning',
			okValue: '确定',
			ok: true,
			lock: true,
            fixed: true,
            top: "200px",
		});
		
        return false;
    }
    txt.value = cvalue; //更新减少后的值
}

//增加采购数量，increaseBuyNum(1678')
function increaseBuyNum(pid)
{
    var txt = document.getElementById(pid);
    var pkg = parseInt(txt.getAttribute('pkg'), 10);
	var cvalue = parseInt(txt.value, 10);
    if (cvalue % pkg != 0) {
		//alert('请按包装量 '+pkg+' 的倍数购买!比如：'+pkg+'*3='+pkg*3+'个。');
		
		art.dialog({
			content: '请按包装量 '+pkg+' 的倍数购买!比如：'+pkg+'*3='+pkg*3+'个。',
			time: 3,
			opacity: 0.2,	// 透明度
			title: '系统提示（3秒后自动关闭）',
			icon: 'warning',
			ok: true,
			lock: true,
            fixed: true,
            top: "200px",
		});
		
        return false;
    }
    cvalue = cvalue + pkg;
    txt.value = cvalue; //更新增加后的值
}

//添加到购物车
function addToShopCart(pid)
{
	//alert('暂时不能加入购物车,如有需求请联系客服');
	//return false;
    var txt = document.getElementById(pid);
    var pkg = txt.getAttribute("pkg");
    var pcount = txt.value;
    var pstock = txt.getAttribute("stock");
	var pdelivery = txt.getAttribute("delivery");
    var regexp = /^[0-9]{1,10}$/;  //验证数字
    if (!pcount.match(regexp)) {
        //alert('请按包装量 '+pkg+' 的倍数购买!');
		art.dialog({
			content: '请按包装量 '+pkg+' 的倍数购买!',
			time: 3,
			opacity: 0.2,	// 透明度
			title: '系统提示（3秒后自动关闭）',
			icon: 'warning',
			ok: true,
			lock: true,
            fixed: true,
            top: "200px",
		});
        txt.focus();
        return false;
    }

    pcount = parseInt(pcount, 10);
    pkg = parseInt(pkg, 10);
    pstock = parseInt(pstock, 10);
    if (pcount % pkg != 0) {
        //alert('请按包装量 '+pkg+' 的倍数购买!');
		art.dialog({
			content: '请按包装量 '+pkg+' 的倍数购买!',
			time: 3,
			opacity: 0.2,	// 透明度
			title: '系统提示（3秒后自动关闭）',
			icon: 'warning',
			ok: true,
			lock: true,
            fixed: true,
            top: "200px",
		});
        txt.focus();
        return false;
    } else {
        if(pstock < 0){
          pstock = 0
        }
        if (pcount > pstock) {
            var cfm = confirm("现有库存" + pstock + "个，剩余产品在" + pdelivery + "天左右补齐，请确认购买？");
            if (!cfm) return false;
			/*
			//artdialog有bug，不管如何回答，直接执行下面的代码了。需要将和购物车互动的步骤写成函数。
			var cfm = false;
			art.dialog.confirm("现有库存" + pstock + "个，剩余产品在8周内补齐?", function(){
				cfm = true;
			}, function(){
				cfm = false;
			});
			if (!cfm) return false;
			*/
        }
    }

    $.post("/ajax/cart.php", {"act": "AddToCart", "pid": pid, "pcount": pcount, "pkg": pkg}, function(data) {
		//alert(data);
		if (data.type == "1") {//加入购物车成功
			//TODO 提示成功，询问去结算，还是继续购物比较好
			//location.href = "/cart/"; //跳转到购物车页面
			art.dialog({
				content: data.msg,
				//time: 3,
				title: '系统提示',
				opacity: 0.2,	// 透明度
				icon: 'succeed',
				lock: true,
                fixed: true,
                top: "200px",
				button: [
					{
						name: '进入购物车',
						callback: function () {
							location.href = "./cart.php";
						},
						focus: false
					},
					{
						name: '继续浏览',
						callback: function () {
							window.location.reload()
							return false;
							//alert('你不同意')
						},
						focus: true
					}
				]
			});
			return true;
		}
		else {
			art.dialog({
				content: data.msg,
				title: '系统提示',
				opacity: 0.2,
				lock: true,
				icon: 'error',
				ok: true,
                fixed: true,
                top: "200px",
			});
			return false;
		}
	});
}
</script>



<script>
          document.getElementById("search_input").addEventListener("keydown", function(event) {
        if (event.keyCode === 13) {
            //TODO：事件处理逻辑
            goSearch()
        }
        });
        function goSearch(){
        var keyword = $("#search_input").val()
        if (keyword.trim() == ""){
            alert("请输入内容后搜索")
            return
        }
        location.href="./product.php?keyword=" + keyword
    }
    $("#search_input").blur(function(){
        $(".search_input li").remove()
        $(".search_input ul").hide();
    })
    $("#search_input").focus(function(){
        func($(this).val())
    })

    function func(str) {
        $.ajax({
            type: "GET",
            url: "/product/alternative_keyword.php",
            async:true,
            data: {keyword:str},
            dataType: "json",
            success: function(data){
                $(".search_input li").remove()
                if(data.length>0){
                    // $("#selectId").show();
                    // $("#selectId").empty();
                    // var optionItem=$("<option></option>").append(" 请选择 ").attr("value","");
                    // optionItem.appendTo($("#selectId"));

                    for(var i=0;i<data.length;i++){
                        // var optionItem=$("<option></option>").append(data[i].name).attr("value",data[i].name);
                        // optionItem.appendTo($("#selectId"));
                        //$("#parentIndustryUL").append(" <li value="+data[i].name+">"+data[i].name+"</li>");
                        $(".search_input ul").append(" <li><a target='_blank' href=\"/new/product.php?keyword="+ data[i].name +"\"><p>"+data[i].name+"</p></a></li>");
                    }
                    //设置默认值
                    
                    $(".search_input ul").show();
                }else{
                    $(".search_input ul").hide();
                }
            }
        });
    }
      $(".login_alert_content_close").click(function(){
        $(".login_alert_block").hide()
    })
    // 移上移出
    $('#top_shopping_cut').mouseover(function(){
        $(this).find(".cut_cont_tankuang").show();
        
    }).mouseout(function(){
        $(this).find(".cut_cont_tankuang").hide();
    });
    $('.pro_bottom_img').mouseover(function(){
                $(".pro_top_img").attr("src", $(this).attr("src"))
                $(".pro_top_img").attr("jqimg", $(this).attr("src"))
                $(this).parent().css("border-color", "#E90211")
            }).mouseout(function(){
                $(this).parent().css("border-color", "#DDDDDD")
            });
    $('.phone_scan').mouseover(function(){
        $(this).addClass('act_li');
        $(this).find(".shibie_block").show();
    }).mouseout(function(){
        $(this).removeClass('act_li')
        $(this).find(".shibie_block").hide();
    });
    $('#logining li').mouseover(function(){
        $(this).find(".nav_tanceng").show();
    }).mouseout(function(){
        $(this).find(".nav_tanceng").hide();
    });
        
    $('#no_logon li').mouseover(function(){
        $(this).find(".nav_tanceng").show();
    }).mouseout(function(){
        $(this).find(".nav_tanceng").hide();
    });

 
    var imgSwiper = new Swiper('#top_pro_small_cont_swiper', {
              direction: 'horizontal',
              slidesPerView : 4,
              pagination: '.swiper-pagination',
              paginationClickable: true,
              nextButton: '.pick_btn_next',
              prevButton: '.pick_btn_prev',
              spaceBetween: 5,
              hashnav: true,
              hashnavWatchState: true
          });
    $("#collect_product").click(function(){
      <?php if(!$_SESSION[SESSION_PREFIX]['user_id']): ?>
        $(".login_alert_block").show()
        return
      <?php endif; ?>
    })

    function addToFav(id)
      {
        $.post("/ajax/favorite.php", { "act": "addToFav", "pid": id }, function(data) {
          if(data.type=='add')
          {
            $("#collect_product").addClass("act_li")
            $(".shoucangBtn").text("取消收藏：")
            art.dialog({
              content: data.msg,
              title: '收藏成功',
              opacity: 0.2,
              lock: true,
              icon: 'succeed',
              ok: true,
              fixed: true,
              top: "200px",
            });
          }
          else if(data.type=='del')
          {
            $("#collect_product").removeClass("act_li")
            $(".shoucangBtn").text("加入收藏：")
            art.dialog({
              content: data.msg,
              title: '取消收藏成功',
              opacity: 0.2,
              lock: true,
              icon: 'succeed',
              ok: true,
              fixed: true,
              top: "200px",
            });
          }
          else
          {
            //alert('Error:'+data.msg);
          }
        });
      }

      function shareUrl(social){
      var _title = encodeURIComponent(document.title);
      var _url = encodeURIComponent(document.location.href);
      var _pic = "<?php echo $domain; ?>/upload<?php echo $pic_list[0]['pic100']; ?>";
      if(social == 'qzone'){				
        var _shareUrl = 'https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' + _url + '&title=' + _title + '&pics=' + _pic + '&summary=&desc=';			
      }else if(social == 'weibo'){
        var _shareUrl = 'https://service.weibo.com/share/share.php?url=' + _url + '&title=' + _title + '&pic=' + _pic;
      }
      window.open(_shareUrl,'_blank');
    }


    (function (t){
    t.fn.jqueryzoom = function (e)
    {
        var i = {
            xzoom : 200, yzoom : 200, offset : 10, position : "right", lens : 1, preload : 1
        };
        e && t.extend(i, e);
        var s = "";
        t(this).hover(function ()
        {
            function e(t)
            {
                this.x = t.pageX, this.y = t.pageY
            }
            var a = t(this).offset().left, n = t(this).offset().top, o = t(this).find("img").get(0).offsetWidth, 
            r = t(this).find("img").get(0).offsetHeight;
            s = t(this).find("img").attr("alt");
            var c = t(this).find("img").attr("jqimg");
            t(this).find("img").attr("alt", ""), 0 == t("div.zoomdiv").get().length && (t(this).after("<div class='zoomdiv'><img class='bigimg' src='" + c + "'/></div>"), 
            t(this).append("<div class='jqZoomPup'>&nbsp;</div>")), t("div.zoomdiv").width(i.xzoom), t("div.zoomdiv").height(i.yzoom), 
            t("div.zoomdiv").show(), i.lens || t(this).css("cursor", "crosshair"), t(document.body).mousemove(function (s)
            {
                mouse = new e(s);
                var c = t(".bigimg").get(0).offsetWidth, d = t(".bigimg").get(0).offsetHeight, l = "x", 
                p = "y";
                if (isNaN(p) | isNaN(l))
                {
                    var p = c / o, l = d / r;
                    t("div.jqZoomPup").width(i.xzoom / (1 * p)), t("div.jqZoomPup").height(i.yzoom / (1 * l)), 
                    i.lens && t("div.jqZoomPup").css("visibility", "visible")
                }
                xpos = mouse.x - t("div.jqZoomPup").width() / 2 - a, ypos = mouse.y - t("div.jqZoomPup").height() / 2 - n, 
                i.lens && (xpos = a > mouse.x - t("div.jqZoomPup").width() / 2 ? 0 : mouse.x + t("div.jqZoomPup").width() / 2 > o + a ? o - t("div.jqZoomPup").width() - 2 : xpos, 
                ypos = n > mouse.y - t("div.jqZoomPup").height() / 2 ? 0 : mouse.y + t("div.jqZoomPup").height() / 2 > r + n ? r - t("div.jqZoomPup").height() - 2 : ypos), 
                i.lens && t("div.jqZoomPup").css({
                    top : ypos, left : xpos
                }), scrolly = ypos, t("div.zoomdiv").get(0).scrollTop = scrolly * l, scrollx = xpos, t("div.zoomdiv").get(0).scrollLeft = scrollx * p;
            })
        },
        function ()
        {
            t(this).children("img").attr("alt", s), t(document.body).unbind("mousemove"), i.lens && t("div.jqZoomPup").remove(), 
            t("div.zoomdiv").remove()
        }), count = 0, i.preload && (t("body").append("<div style='display:none;' class='jqPreload" + count + "'>360buy</div>"), 
        t(this).each(function ()
        {
            var e = t(this).children("img").attr("jqimg"), i = jQuery("div.jqPreload" + count).html();
            jQuery("div.jqPreload" + count).html(i + '<img src="' + e + '">')
        }))
    }
})(jQuery);

$(function (){
	$(".jqzoom").jqueryzoom({
        xzoom : 350, yzoom : 350, offset : 10, position : "left", preload : 1, lens : 1
    });
});
$(".showLoginBtn").click(function(){
        $("#captcha").attr("src", "../includes/securimage/securimage_show.php?sid=" + Math.random())
        $(".login_alert_block").show()
    })
    $("#signin_btn").click(function(){
        var userName = $(".user_name").val()
        var password = $(".user_pwd").val()
        var imgCode = $(".user_code").val()
        $.post("/new/login.php", {act: "post", username: userName, imgcode: imgCode, pwd: password}, function(res){
            res = JSON.parse(res)
            if(res.code != 200){
                $("#err_msg").text(res.msg)
            }else{
                $("#err_msg").text("登陆成功")

                window.location.reload()
                return
            }

            $("#captcha").attr("src", "../includes/securimage/securimage_show.php?sid=" + Math.random())
        })
    })
</script>

<?php
  //规格参数表里的值，宽度
  //宽度=450/x-2，x是列数
  $cpcs_arr = explode(',', $product['cpcs']);
  $cpnum = count($cpcs_arr);
  $width = floor((448-$cpnum)/$cpnum-2);
  ?>
    <style type="text/css">
  .cc-w{width:<?php echo $width;?>px;}
  /*.cc-w{width:<?php echo ceil(100/$cpnum)-2;?>%;}*/
  /*.cc-w{text-align:center;display:inline-block;*display:inline;*zoom:1;}*/
  .att1{text-align:center !important;border-bottom:0px !important; border-top:0px !important; border-left:0px !important; border-right:0px !important;}
  .att2{text-align:center !important;border-bottom:0px !important; border-top:0px !important; border-left:#b6b6b6 1px solid !important; border-right:0px !important;}
  .att3{text-align:center !important;border-bottom:0px !important; border-top:0px !important; border-left:0px !important; border-right:0px !important;}
  .att4{text-align:center !important;border-bottom:0px !important; border-top:0px !important; border-left:#b6b6b6 1px dotted !important; border-right:0px !important;}
  .t2:hover{background-color:#e1eef5;}
  
  .gga a:hover{color:#333;}
  </style>